<?php
/**
*  新闻咨询
*/
namespace app\api\model;
use think\Model;

class Article extends Model
{
    /**
    *  列表
    */
    public function _list($where = 'status = 1', $order_by="sort asc", $page_size = PAGE_SIZE_API){
        $obj = $this->order($order_by);
        $data = $this->where($where)
            ->field('id, title, content, type')
            ->order($order_by)
            ->paginate($page_size)
            ->toArray();
        return $data;
    }
    
    /**
    * 首页通知
    */
    public function _indexNotice(){
        $data = $this->alias('a')
            ->field('a.id, a.title')
            ->join('article_type at', 'a.type_id = at.id', 'LEFT')
            ->where([['a.status', '=', 1], ['at.key', '=', 'SYS_NOTICE']])
            ->order("a.sort desc")
            ->select();
        
        return $data;
    }
    

}